﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace MQTT.Server.Host
{
    public class IntConvertIsOnline : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            byte isOnline = (byte) value;
            string strIsOnline = "未知";
            if (isOnline == 0)
            {
                strIsOnline = "离线";
            }
            else if (isOnline == 1)
            {
                strIsOnline = "在线";
            }
            else
            {
                strIsOnline = "未知";
            }

            return strIsOnline;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
